//
//  LYRequestTool.m
//  artist
//
//  Created by laotang on 16/4/4.
//  Copyright © 2016年 viviyoo. All rights reserved.
//

#import "LYRequestTool.h"
#import "LYRequestManager.h"
#import "LYUserInfoModel.h"
#import "LYLoginInfoModel.h"
#import "LYCircleInfoModel.h"
#import "LYRequestInfo.h"
#import "LYCircleListModel.h"
#import "LYPostDetailModel.h"
#import "LYReviewUserModel.h"
#import "LYPostListModel.h"
#import "LYUrlManager.h"
#import "LYSelectedClassesModel.h"
#import "LYChatFriendsModel.h"
#import "LYArticleModel.h"
#import "LYStudentInfoModel.h"
#import "LYApplyFriendListModel.h"
#import "LYCollectListModel.h"
#import "LYMySubjectListModel.h"
#import "LYMyIntegralListModel.h"
#import "LYOrderDetailModel.h"
#import "LYMyAccountListModel.h"
#import "LYVideoModel.h"
#import "LYWXPayModel.h"
#import "LYMineCommentModel.h"
#import "LYCommentListModel.h"
#import "LYIntegrationModel.h"
#import "LYBannerModelModel.h"
#import "LYAlipayModel.h"
#import "LYCountTestModel.h"

@implementation LYRequestTool


+ (void)loginWithUserName:(NSString *)userName Password:(NSString *)password success:(void (^)(LYLoginInfoModel *))success failure:(void (^)(NSString *, NSString *))failure{
    NSDictionary *parameterDic = @{
                                   @"username":LYNoNullString(userName),
                                   @"password":LYNoNullString(password),
                                   @"appid": LYNoNullString(LYAppId),
                                   };

    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Auth/login") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {

       LYLoginInfoModel *userInfo =  [LYLoginInfoModel mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(userInfo);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];

}
+ (void)registerWithUserName:(NSString *)userName
                    Password:(NSString *)password
                 verify_code:(NSString *)verify_code
                     success:(void (^)(NSString *))success
                     failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"username":LYNoNullString(userName),
                                   @"password":LYNoNullString(password),
                                   @"appid": LYNoNullString(LYAppId),
                                   @"verify_code":LYNoNullString(verify_code)
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Auth/register") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data[@"token"]);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}
+ (void)sendMessageVerificationWithmobile_phone:(NSString *)mobile_phone verify_type:(LYverifyType)verify_type success:(void (^)(NSString *))success failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"mobile_phone":LYNoNullString(mobile_phone),
                                   @"verify_type":[@(verify_type) stringValue],
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Mobile/send_verify") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data[@"verify_code"]);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)acquireUserInfoWithToken:(NSString *)token
                         success:(void (^)(LYUserInfoModel *))success
                         failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/info") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            
            LYUserInfoModel *userInfo =  [LYUserInfoModel mj_objectWithKeyValues:requestInfo.data];
                success(userInfo);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)resetPasswordWithUserName:(NSString *)userName
                         Password:(NSString *)password
                      verify_code:(NSString *)verify_code
                          success:(void (^)(void))success
                          failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"username":LYNoNullString(userName),
                                   @"password":LYNoNullString(password),
                                   @"verify_code":LYNoNullString(verify_code),

                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Auth/reset_pwd") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)updateUserPwdWithToken:(NSString *)token
                       old_pwd:(NSString *)oldPwd
                        newPwd:(NSString *)NewPwd
                       success:(void (^)(void))success
                       failure:(requestFailureHandle)failure{

    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"old_pwd" : LYNoNullString(oldPwd),
                                   @"new_pwd" : LYNoNullString(NewPwd)
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/update_pwd") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];

    

}

+ (void)updateUserInfoWithToken:(NSString *)token
                      nick_name:(NSString *)nick_name
                       head_pic:(NSString *)head_pic
                       birthday:(NSString *)birthday
                            sex:(NSString *)sex
                        success:(void (^)(void))success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"nick_name":LYNoNullString(nick_name),
                                   @"head_pic":LYNoNullString(head_pic),
                                   @"birthday":LYNoNullString(birthday),
                                   @"sex":LYNoNullString(sex),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/info") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

#pragma mark - 更新资料

+ (void)setPersonalInfo:(LYUpdateInfoModel *)personalInfo
                success:(void (^)(void))success
                failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = [personalInfo mj_keyValues];
    
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/update_info") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

#pragma mark - 关注、收藏、点赞

/**
 *  关注
 */
+ (void)followWithToken:(NSString *)token
             to_user_id:(NSString *)to_user_id
                success:(void (^)(void))success
                failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/follow") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
    
}
/**
 *  取消关注
 */
+ (void)cancelfollowWithToken:(NSString *)token
                   to_user_id:(NSString *)to_user_id
                      success:(void (^)(void))success
                      failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/cancel_follow") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

/**
 *  收藏
 */
+ (void)collectionWithToken:(NSString *)token
                       type:(ObjectType)type
                    data_id:(NSString *)data_id
                    success:(void (^)(void))success
                    failure:(requestFailureHandle)failure{
    
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"type":LYNoNullString([@(type) stringValue]),
                                   @"data_id":LYNoNullString(data_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Collect/add") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}
/**
 *  取消收藏
 */
+ (void)cancelCollectionWithToken:(NSString *)token
                             type:(ObjectType)type
                          data_id:(NSString *)data_id
                          success:(void (^)(void))success
                          failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"type":LYNoNullString([@(type) stringValue]),
                                   @"data_id":LYNoNullString(data_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Collect/cancel") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
    
}

/**
 *  点赞
 */
+ (void)praiseWithToken:(NSString *)token
                   type:(ObjectType)type
                data_id:(NSString *)data_id
                success:(void (^)(void))success
                failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"type":LYNoNullString([@(type) stringValue]),
                                   @"data_id":LYNoNullString(data_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Praise/add") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
/**
 *  取消点赞
 */
+ (void)cancelPraiseWithToken:(NSString *)token
                         type:(ObjectType)type
                      data_id:(NSString *)data_id
                      success:(void (^)(void))success
                      failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"type":LYNoNullString([@(type) stringValue]),
                                   @"data_id":LYNoNullString(data_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Praise/cancel") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}
#pragma mark - 好友、好友申请

/**
 *  申请好友
 */
+ (void)getApplyFriendWithToken:(NSString *)token
                     to_user_id:(NSString *)to_user_id
                         remark:(NSString *)remark
                        success:(void (^)(NSString *userID))success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   @"remark":LYNoNullString(remark),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Friend/apply") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data[@"id"]);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

/**
 *  申请好友列表
 */
+ (void)getApplyFriendListWithToken:(NSString *)token
                               page:(NSString *)page
                           per_page:(NSString *)per_page
                            success:(void (^)(NSArray<LYApplyFriendListModel *> *))success
                            failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"page":LYNoNullString(page),
                                   @"per_page":LYNoNullString(per_page),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Friend/apply_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYApplyFriendListModel *> *listModel = [LYApplyFriendListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"apply_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)searchFriendWithToken:(NSString *)token
                      keyword:(NSString *)keyword
                      success:(void (^)(NSArray<LYSearchFriendModel *> *))success
                      failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"keyword":LYNoNullString(keyword),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Friend/search") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYSearchFriendModel *> *listModel = [LYSearchFriendModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"user_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}


#pragma mark - 其他会员的信息

+ (void)getOtherInfoWithToken:(NSString *)token
                   to_user_id:(NSString *)to_user_id
                           success:(void (^)(LYPersonalInfo *))success
                           failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token" : LYNoNullString(token),  @"to_user_id":LYNoNullString(to_user_id),
                                   };
        [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/other_info") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
            LYPersonalInfo *personal = [LYPersonalInfo mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(personal);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}
#pragma mark - 我的积分、课程、视频、关注


+ (void)getMyIntegralWithToken:(NSString *)token
                       success:(void (^)(NSString *integral))success
                       failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/integral") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data[@"integral"]);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)getMyCollectionWithToken:(NSString *)token
                            type:(ObjectType)type
                         success:(void (^)(NSArray *))success
                         failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"type":LYNoNullString([@(type) stringValue]),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Collect/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        Class modelClass = [[LYDataSourceManager sharedManager] getCollectListClassWithType:type];
        
        NSArray *listModel = [modelClass mj_objectArrayWithKeyValuesArray:requestInfo.data[@"collect_list"]];
        
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)getMyClassWithToken:(NSString *)token
                       page:(NSString *)page
                   per_page:(NSString *)per_page
                    success:(void (^)(NSArray <LYMyClassListModel *>*))success
                    failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"page":LYNoNullString(page),
                                   @"per_page":LYNoNullString(per_page),
                                   @"self":@"1",
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Course/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        NSArray<LYMyClassListModel *> *listModel = [LYMyClassListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"course_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}


+ (void)closeClassWithToken:(NSString *)token
                  course_id:(NSString *)course_id
                    success:(void(^)())success
                    failure:(requestFailureHandle)failure{

    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"course_id":LYNoNullString(course_id)
                                   };

    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Course/close") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {

        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];


}

+ (void)getMyVideoWithToken:(NSString *)token
                       page:(NSString *)page
                   per_page:(NSString *)per_page
                    success:(void (^)(NSArray <LYMyVideoListModel *>*))success
                    failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"page":LYNoNullString(page),
                                   @"per_page":LYNoNullString(per_page),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Video/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        NSArray<LYMyVideoListModel *> *listModel = [LYMyVideoListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"video_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)getMyPublicWithToken:(NSString *)token
                        page:(NSString *)page
                    per_page:(NSString *)per_page
                     success:(void (^)(NSArray <LYPostDetailModel *>*))success
                     failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"type": @"user",
                                   @"page":LYNoNullString(page),
                                   @"per_page":LYNoNullString(per_page),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/get_topic_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        NSArray<LYPostDetailModel *> *listModel = [LYPostDetailModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"topic_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)getMyFollowListWithToken:(NSString *)token
                         role_id:(LYRoleType)role_id
                         success:(void (^)(NSArray <LYPersonalInfo *>*))success
                         failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"role_id":LYNoNullString([@(role_id) stringValue]),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/follow_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        NSArray<LYPersonalInfo *> *listModel = [LYPersonalInfo mj_objectArrayWithKeyValuesArray:requestInfo.data[@"follow_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}


+ (void)getCanuseIntegrationWithToken:(NSString *)token
                        success:(void (^)(LYIntegrationModel*))success
                        failure:(requestFailureHandle)failure{
    
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/integral") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        LYIntegrationModel *model = [LYIntegrationModel mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(model);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

#pragma mark - 获取学生信息

+ (void)getStudentInfoWithToken:(NSString *)token
                     to_user_id:(NSString *)to_user_id
                        success:(void (^)(LYStudentInfoModel*))success
                        failure:(requestFailureHandle)failure;{
    
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/other_info") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        LYStudentInfoModel *model = [LYStudentInfoModel mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(model);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

#pragma mark - 获取我的兴趣列表、更新

+ (void)getMySubjectListWithToken:(NSString *)token
                          success:(void (^)(NSArray <LYMySubjectListModel *>*))success
                          failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"UserSubject/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        NSArray<LYMySubjectListModel *> *listModel = [LYMySubjectListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"subject_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}


+ (void)updateMySubjectListWithToken:(NSString *)token
                          subject_id:(NSString *)subject_id
                             success:(void (^)())success
                             failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"subject_id":LYNoNullString(subject_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"UserSubject/update") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {

        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

#pragma mark - 每日签到/签到查询


+ (void)userSiginWithToken:(NSString *)token
                   success:(void (^)())success
                   failure:(requestFailureHandle)failure{
    
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"UserSignin/add") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

/**
 *  查询签到
 */
+ (void)userSiginListsWithToken:(NSString *)token
                     start_date:(NSString *)start_date
                       end_date:(NSString *)end_date
                        success:(void (^)(NSArray<LYSigninModel *> *))success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"start_date":LYNoNullString(start_date),
                                   @"end_date":LYNoNullString(end_date),

                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"UserSignin/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYSigninModel *> *listModel = [LYSigninModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"signin_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
#pragma mark - 我的评价、更新我的评价

/**
 *  更新我的评价
 *
 *  @param subject_id 2,3,4 // 用逗号隔开
 */
+ (void)updateMyCommenttWithToken:(NSString *)token
                       comment_id:(NSString *)comment_id
                          content:(NSString *)content
                             star:(NSString *)star
                          success:(void (^)())success
                          failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"comment_id":LYNoNullString(comment_id),
                                   @"content":LYNoNullString(content),
                                   @"star":LYNoNullString(star),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Comment/update_course") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {

        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

/**
 *  我的评价
 */
+ (void)getMyCommenttWithToken:(NSString *)token
                          page:(NSString *)page
                      per_page:(NSString *)per_page
                       success:(void (^)(NSArray <LYMineCommentModel *>*))success
                       failure:(requestFailureHandle)failure{

    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"page":LYNoNullString(page),
                                   @"per_page":LYNoNullString(per_page),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Comment/course_List") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYMineCommentModel *> *listModel = [LYMineCommentModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"comment_list"]];
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];


    
    
}




#pragma mark - 消息列表、未读消息数、标记已读消息
+ (void)getUnreadListMessageWithToken:(NSString *)token
                              success:(void (^)(NSArray<LYMyMessageListModel *> *))success
                              failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Message/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYMyMessageListModel *> *listModel = [LYMyMessageListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"message_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)getUnreadCountMessageWithToken:(NSString *)token
                               success:(void (^)(NSString *))success
                               failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Message/unread_num") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {

        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data[@"unread_num"]);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}
/**
 *  标记以已读的信息
 * id 的格式 ： 1,2,3
 */
+ (void)signUnreadMessageWithToken:(NSString *)token
                                id:(NSString *)Id
                           success:(void (^)())success
                           failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Message/read") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data[@"unread_num"]);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
    
}

#pragma mark - 积分日志


+ (void)getIntegralListWithToken:(NSString *)token
                         success:(void (^)(NSArray<LYMyIntegralListModel *> *))success
                         failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Integral/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYMyIntegralListModel *> *listModel = [LYMyIntegralListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"integral_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

#pragma mark - 获取七牛的token

+ (void)acquirQiNiusuccess:(void (^)(NSString *))success failure:(requestFailureHandle)failure{
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Util/qiniu_token") Parameters:[NSDictionary dictionary] success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data[@"qiniu_token"]);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}


+ (void)checkCicleAuthorizationWithToken:(NSString *)token
                                 success:(void (^)(NSString *))success
                                 failure:(requestFailureHandle)failur{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token)
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/check_circle_priv") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data);
        }
    } failure:^(NSURLSessionDataTask * _Nullable dataTask, NSError * _Nonnull error) {
        
    
    }];
}

+ (void)checkCiclExistWithToken:(NSString *)token
                     circleperName:(NSString *)circleName
                        success:(void (^)(NSString *))success
                        failure:(requestFailureHandle)failur{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"name":LYNoNullString(circleName)
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/check_circle_name") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data);
        }
    } failure:nil];
    
}

+ (void)creatCiclExistWithToken:(NSString *)token
                     circleName:(NSString *)circleName
                           type:(LYCicleType )type
                           desc:(NSString *)desc
                        success:(void (^)(NSString *))success
                        failure:(requestFailureHandle)failur{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"name":LYNoNullString(circleName),
                                   @"type":[@(type) stringValue],
                                   @"desc":LYNoNullString(desc)
                                   };
    

    
}


+ (void)acquirCircleInfoWithToken:(NSString *)token
                        circle_id:(NSString *)circle_id
                          success:(void (^)(LYCircleInfoModel *))success
                          failure:(requestFailureHandle)failur{
    
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"circle_id":LYNoNullString(circle_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/get_circle") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
          LYCircleInfoModel *info = [LYCircleInfoModel mj_objectWithKeyValues:requestInfo.data];
            success(info);
        }
    } failure:nil];
    
}

+ (void)acquirCircleListWithToken:(NSString *)token
                             type:(NSString *)type
                          success:(void (^)(NSArray<LYCircleListModel *> *))success
                          failure:(requestFailureHandle)failur{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"type":LYNoNullString(type),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/get_circle_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            NSArray *cirleList = [LYCircleListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"circle_list"]];
            success(cirleList);
        }
    } failure:nil];
}


+ (void)joinCircleListWithToken:(NSString *)token
                      circle_id:(NSString *)circle_id
                        success:(void (^)(void))success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"circle_id":LYNoNullString(circle_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/join") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)exitCircleListWithToken:(NSString *)token
                      circle_id:(NSString *)circle_id
                        success:(void (^)(void))success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"circle_id":LYNoNullString(circle_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/exit_circle") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}


+ (void)publicPosttWithToken:(NSString *)token
                   circle_id:(NSString *)circle_id
                     content:(NSString *)content
                      images:(NSString *)images
                     success:(void (^)(NSString * topicId))success
                     failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"circle_id":LYNoNullString(circle_id),
                                   @"content":LYNoNullString(content),
                                   @"images":LYNoNullString(images),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/create_topic") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success(requestInfo.data);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];

    
    
}

+ (void)acquirCircleListWithToken:(NSString *)token
                         topic_id:(NSString *)topic_id
                          success:(void (^)(LYPostDetailModel *))success
                          failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/get_topic") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            
           LYPostDetailModel *postDetail = [LYPostDetailModel mj_objectWithKeyValues:requestInfo.data];
            if(success){
                success(postDetail);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
+ (void)acquirPostCircleListWithToken:(NSString *)token
                                 type:(NSString *)type
                            circle_id:(NSString *)circle_id
                                 page:(NSString *)page
                             per_page:(NSString *)per_page
                              success:(void (^)(NSArray<LYPostDetailModel*> *))success
                              failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"circle_id":LYNoNullString(circle_id),
                                   @"type":LYNoNullString(type),
                                   @"page" : page,
                                   @"per_page" : per_page
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/get_topic_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            
            NSArray *topicArray = [LYPostDetailModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"topic_list"]];
            if(success){
                success(topicArray);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)parisePostWithToken:(NSString *)token
                   topic_id:(NSString *)topic_id
                    success:(void (^)(void))success
                    failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/topic_praise") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)cnacelParisePostWithToken:(NSString *)token
                         topic_id:(NSString *)topic_id
                          success:(void (^)(void))success
                          failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/topic_praise_cancel") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}


+ (void)acquirViewUsersWithToken:(NSString *)token
                        topic_id:(NSString *)topic_id
                         success:(void (^)(NSArray <LYReviewUserModel *> *))success
                         failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/topic_view_user") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            
           NSArray * reviewArray =  [LYReviewUserModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"user_list"]];
            if(success){
                success(reviewArray);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

/**
 *  赞过帖子的用户
 */
+ (void)acquirPariseUsersWithToken:(NSString *)token
                          topic_id:(NSString *)topic_id
                           success:(void (^)(NSArray <LYReviewUserModel *> *))success
                           failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/topic_praise_user") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            
            NSArray * reviewArray =  [LYReviewUserModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"user_list"]];
            if(success){
                success(reviewArray);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

/**
 *  关注帖子
 */
+ (void)followPostWithToken:(NSString *)token
                   topic_id:(NSString *)topic_id
                    success:(void (^)(void))success
                    failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/topic_add_follow") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

/**
 *  取消关注帖子
 */
+ (void)cancelFollowPostWithToken:(NSString *)token
                         topic_id:(NSString *)topic_id
                          success:(void (^)(void))success
                          failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/topic_cancel_follow") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)getCommentListWithToken:(NSString *)token
                           type:(CommentType)type
                        data_id:(NSString *)data_id
                        success:(void (^)(NSArray<LYCommentListModel *>*))success
                        failure:(requestFailureHandle)failure{

    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"data_id":LYNoNullString(data_id),
                                   @"type" : [@(type) stringValue]
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Comment/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            
            NSArray <LYCommentListModel *>*models = [LYCommentListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"comment_list"]];
            
            if(success){
                success(models);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];

    

}

+ (void)sendCommentWithToken:(NSString *)token
                        type:(CommentType)type
                  to_user_id:(NSString *)to_user_id
                     data_id:(NSString *)data_id
                     content:(NSString *)content
                        star:(NSInteger)star
                    order_sn:(NSString *)order_sn
                     success:(void (^)(void))success
                     failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"data_id":LYNoNullString(data_id),
                                   @"type" : [@(type) stringValue],
                                   @"to_user_id" : LYNoNullString(to_user_id),
                                   @"content" : LYNoNullString(content),
                                   @"star" : [@(star) stringValue],
                                   @"order_sn" : LYNoNullString(order_sn),
                                   };

    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Comment/add") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];


}

+ (void)commentPostWithToken:(NSString *)token
                    topic_id:(NSString *)topic_id
                     success:(void (^)(void))success
                     failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/topic_cancel_follow") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)commentPostWithToken:(NSString *)token
                    topic_id:(NSString *)topic_id
                  to_user_id:(NSString *)to_user_id
                     content:(NSString *)content
                     success:(void (^)(NSString *comment_id))success
                     failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   @"content":LYNoNullString(content),

                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/add_topic_comment") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success(requestInfo.data);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
+ (void)commentListPostWithToken:(NSString *)token
                        topic_id:(NSString *)topic_id
                         success:(void (^)(NSArray <LYPostListModel *> *))success
                         failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"topic_id":LYNoNullString(topic_id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Circle/get_topic_comment_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
       NSArray *listModel =  [LYPostListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"LYPostListModel"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success(listModel);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)getClassesListWithToken:(NSString *)token success:(void (^)(NSArray <LYSelectedClassesModel *> *))success failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Subject/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        NSArray *listModel =  [LYSelectedClassesModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"subject_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success(listModel);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}
+ (void)postVideoWithToken:(NSString *)token title:(NSString *)title desc:(NSString *)desc
                      link:(NSString *)link image:(NSString *)image success:(void (^)())success failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"title":LYNoNullString(title),
                                   @"desc":LYNoNullString(desc),
                                   @"link":LYNoNullString(link),
                                   @"image":LYNoNullString(image),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Video/add") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}


/**
 *  好友列表
 */
+ (void)acquirFriendssWithToken:(NSString *)token
                        success:(void (^)(NSArray <LYChatFriendsModel *> *))success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/get_friends") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        NSArray *listModel =  [LYChatFriendsModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"friend_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success(listModel);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}


+ (void)addFriendssWithToken:(NSString *)token
                      userID:(NSString *)userID
                     success:(void (^)())success
                     failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(userID),
                                   
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Friend/add") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
    
}

+ (void)deleteFriendssWithToken:(NSString *)token
                         userID:(NSString *)userID
                        success:(void (^)())success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(userID),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Friend/delete") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success();
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}


/**
 *  获取科目接口
 */
+ (void)getCategorylistWithPid:(NSString *)pid
                       success:(void (^)(NSArray <LYArticleModel *> *))success
                       failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"pid":LYNoNullString(pid),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Article/category_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        NSArray *listModel =  [LYArticleModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"category_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success(listModel);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

/**
 *  获取文章列表
 */
+ (void)getArticlelistsWithCategoryId:(NSString *)categoryId
                                 page:(NSString *)page
                             perPpage:(NSString *)perPage
                              success:(void (^)(NSArray <LYArticleListModel *> *))success
                              failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"category_id":LYNoNullString(categoryId),
                                   @"page":LYNoNullString(page),
                                   @"per_page":LYNoNullString(perPage),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Article/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        NSArray *listModel =  [LYArticleListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"article_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success(listModel);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}


/**
 *  获取文章详情
 */

+ (void)getArticlelistsWithId:(NSString *)Id
                      success:(void (^)(LYArticleDetailModel *))success
                      failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"id":LYNoNullString(Id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Article/detail") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        LYArticleDetailModel *model =  [LYArticleDetailModel mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"]){
            if(success){
                success(model);
            }
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
#pragma mark - 订单支付

+ (void)orderCancelWithToken:(NSString *)token
                    order_sn:(NSString *)order_sn
                     success:(void (^)())success
                     failure:(requestFailureHandle)failure{

    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"order_sn" : LYNoNullString(order_sn)
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Order/cancel") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];

}

+ (void)orderAddWithToken:(NSString *)token
                course_id:(NSString *)course_id
             use_integral:(NSString *)use_integral
                  success:(void (^)(LYOrderAddModel *))success
                  failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"type" : @"2",
                                   @"course_id":LYNoNullString(course_id),
                                   @"use_integral" : use_integral
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Order/add") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
       LYOrderAddModel *Model = [LYOrderAddModel mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(Model);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)orderDetailWithToken:(NSString *)token
                 order_sn:(NSString *)order_sn
                  success:(void (^)(LYOrderDetailModel *))success
                  failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"order_sn":LYNoNullString(order_sn),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Order/detail") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        LYOrderDetailModel *Model = [LYOrderDetailModel mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(Model);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)orderAddWithToken:(NSString *)token
                     type:(LYOrderState)type
                     page:(NSString *)page
                 per_page:(NSString *)per_page
                  success:(void (^)(NSArray <LYOrderListModel *> *))success
                  failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"type":LYNoNullString([@(type) stringValue]),
                                   @"page" : LYNoNullString(page),
                                   @"per_page" : LYNoNullString(per_page)
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Order/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYOrderListModel *> *listModel = [LYOrderListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"order_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}




+ (void)applyRefundWithToken:(NSString *)token
                     orderSn:(NSString *)order_sn
                     success:(void(^)())success
                     failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"order_sn":LYNoNullString(order_sn)
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Order/refund") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
    
}



+ (void)getPayUnionpayWithToken:(NSString *)token
                       order_sn:(NSString *)order_sn
                        success:(void (^)(NSString  *))success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"order_sn":LYNoNullString(order_sn),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Pay/unionpay_get_tn") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(requestInfo.data[@"tn"]);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
+ (void)getWeChatWithToken:(NSString *)token
                  order_sn:(NSString *)order_sn
                   success:(void (^)(LYWXPayModel  *))success
                   failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"order_sn":LYNoNullString(order_sn),
                                   };
    

    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Pay/get_prepayid") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        LYWXPayModel *Model = [LYWXPayModel mj_objectWithKeyValues:requestInfo.data];
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(Model);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
+ (void)getAlipaySignyWithToken:(NSString *)token
                       order_sn:(NSString *)order_sn
                        success:(void (^)(LYAlipayModel  *))success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"order_sn":LYNoNullString(order_sn),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Pay/alipay_sign") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
         LYAlipayModel *Model = [LYAlipayModel mj_objectWithKeyValues:requestInfo.data];
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(Model);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)scanVerifyWithToken:(NSString *)token
                   order_sn:(NSString *)order_sn
                verify_code:(NSString *)verify_code
                    success:(void (^)(NSString  *))success
                    failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"order_sn":LYNoNullString(order_sn),
                                   @"verify_code":LYNoNullString(verify_code),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Order/verify") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(@"验证成功");
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
#pragma mark - 机构、老师
+ (void)getTeacherWithToken:(NSString *)token
                 to_user_id:(NSString *)to_user_id
                    success:(void (^)(NSArray<LYPersonalInfo *> *))success
                    failure:(requestFailureHandle)failure{
    
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/trainorg_teacher") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYPersonalInfo *> *listModel = [LYPersonalInfo mj_objectArrayWithKeyValuesArray:requestInfo.data[@"teacher_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}
+ (void)getLocalTeacherAndOrganizationWithcontionModel:(LYConditionModel *)condiction
                                               success:(void (^)(NSArray<LYPersonalInfo *> *))success
                                               failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"area_id" : LYNoNullString(condiction.area_id),
                                   @"token" : LYNoNullString(condiction.token),
                                   @"lat" : LYNoNullString(condiction.lat),
                                   @"lng" : LYNoNullString(condiction.lng),
                                   @"role_id" : @(condiction.role_id),
                                   @"order_type" : @(condiction.order_type),
                                   @"subject_id" : LYNoNullString(condiction.subject_path),
                                   @"page" : LYNoNullString(condiction.page),
                                   @"per_page" : LYNoNullString(condiction.per_page),
                                   @"distinct" : LYNoNullString(condiction.distinct),
                                   @"keyword" : LYNoNullString(condiction.keyword)
                                   };
    
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/user_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYPersonalInfo *> *listModel = [LYPersonalInfo mj_objectArrayWithKeyValuesArray:requestInfo.data[@"user_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
    
}

+ (void)getMyTeacherWithToken:(NSString *)token
                         page:(NSString *)page
                     per_page:(NSString *)per_page
                      success:(void (^)(NSArray<LYPersonalInfo *> *))success
                      failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"self": @"1",
                                   @"page" : page,
                                   @"per_page" : per_page
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/trainorg_teacher") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYPersonalInfo *> *listModel = [LYPersonalInfo mj_objectArrayWithKeyValuesArray:requestInfo.data[@"teacher_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)getMyOrganizationWithToken:(NSString *)token
                           success:(void (^)(LYMineOrzInfoModel *))success
                           failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"self": @"1",
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"/User/trainorg_info") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
         LYMineOrzInfoModel *model = [LYMineOrzInfoModel mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(model);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

+ (void)addTeacherWithToken:(NSString *)token
                 to_user_id:(NSString *)to_user_id
                    success:(void (^)())success
                    failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/add_trainorg") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)deleteTeacherWithToken:(NSString *)token
                    to_user_id:(NSString *)to_user_id
                       success:(void (^)())success
                       failure:(requestFailureHandle)failure{
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/delete_teacher") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}


+ (void)addOriganzationWithToken:(NSString *)token
                      to_user_id:(NSString *)to_user_id
                         success:(void (^)())success
                         failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/add_trainorg") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)getMyCountWithToken:(NSString *)token
                       page:(NSString *)page
                   per_page:(NSString *)per_page
                    success:(void (^)(NSArray<LYMyAccountListModel *>*models, NSString * balance))success
                    failure:(requestFailureHandle)failure{
    
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"page":LYNoNullString(page),
                                   @"per_page":LYNoNullString(per_page),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/account_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYMyAccountListModel *> *listModel = [LYMyAccountListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"account_list"]];
        
        NSString * balance = requestInfo.data[@"balance"];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel, balance);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

+ (void)searchWithToken:(NSString *)token
                keyword:(NSString *)keyword
                   role_id:(LYRoleType)role_id
                   page:(NSString *)page
               per_page:(NSString *)per_page
                success:(void (^)(NSArray<LYPersonalInfo *>*))success
                failure:(requestFailureHandle)failure{
    
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"keyword":LYNoNullString(keyword),
                                   @"role_id":LYNoNullString([@(role_id) stringValue]),
                                   @"page":LYNoNullString(page),
                                   @"per_page":LYNoNullString(per_page),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/user_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYPersonalInfo *> *listModel = [LYPersonalInfo mj_objectArrayWithKeyValuesArray:requestInfo.data[@"user_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}


#pragma mark - 课程视频

/**
 *  课程推荐列表
 *
 */
+ (void)commandSubjectListWithToken:(NSString *)token
                            success:(void (^)(NSArray<LYMyClassListModel *>*))success
                            failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Course/recommend_course_list") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYMyClassListModel *> *listModel = [LYMyClassListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"course_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

/**
 * 课程列表
 
 to_user_id 谁的课程 subject_id 科目 keyword 搜索关键字 order 排序字段，1按评价升序，2按评价降序，3按距离升序，4按距离降序
 
 */
+ (void)getSubjectListWithParmeterModel:(LYGetSubjectParameterModel *)parameterModel
                                success:(void (^)(NSArray<LYMyClassListModel *>*))success
                                failure:(requestFailureHandle)failure{
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Course/lists") Parameters:[parameterModel mj_keyValues] success:^(LYRequestInfo *requestInfo) {
        
        
        NSArray<LYMyClassListModel *> *listModel = [LYMyClassListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"course_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:^(NSURLSessionDataTask * _Nullable dataTask, NSError * _Nonnull error) {
        
    }];
}
/**
 *  课程详情
 */
+ (void)getSubjectDeatilWithToken:(NSString *)token
                        course_id:(NSString *)course_id
                          success:(void (^)(LYSubjectDetailModel *))success
                          failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"course_id":LYNoNullString(course_id),

                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Course/detail") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        LYSubjectDetailModel *listModel = [LYSubjectDetailModel mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
/**
 *  新增课程
 */
+ (void)addSubjecWithParmeterModel:(LYSubjectUploadModel *)uploadModel
                           success:(void (^)(NSString *))success
                           failure:(requestFailureHandle)failure{
    
    uploadModel.area_id =nil;
    NSLog(@"==========%@", [uploadModel mj_keyValues]);
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Course/add") Parameters:[uploadModel mj_keyValues] success:^(LYRequestInfo *requestInfo) {
        
        NSString *Id = requestInfo.data[@"id"];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(Id);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}


/**
 *  获取视频列表
 */
+ (void)getVideoListWithToken:(NSString *)token
                   to_user_id:(NSString *)to_user_id
                      keyword:(NSString *)keyword
                        order:(NSString *)order
                         page:(NSString *)page
                     per_page:(NSString *)per_page
                      success:(void (^)(NSArray<LYMyVideoListModel *>*))success
                      failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"to_user_id":LYNoNullString(to_user_id),
                                   @"keyword":LYNoNullString(keyword),
                                   @"order":LYNoNullString(order),
                                   @"page" : LYNoNullString(page),
                                   @"per_page" : LYNoNullString(per_page),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Video/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        NSArray<LYMyVideoListModel *> *listModel = [LYMyVideoListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"video_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}
/**
 *  视频详情
 *
 */
+ (void)getVideoDeatilWithToken:(NSString *)token
                       video_id:(NSString *)video_id
                        success:(void (^)(LYVideoDetailModel *))success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"video_id":LYNoNullString(video_id),
                                   
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Video/detail") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        
        LYVideoDetailModel *listModel = [LYVideoDetailModel mj_objectWithKeyValues:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

/**
 *  在线测试- 列表
 */
+ (void)getOnlineTestListWithPage:(NSString *)page
                         per_page:(NSString *)per_page
                          success:(void (^)(NSArray<LYTestListModel *>*))success
                          failure:(requestFailureHandle)failure{
    
    
    NSDictionary *parameterDic = @{
                                   @"page":LYNoNullString(page),
                                   @"per_page":LYNoNullString(per_page),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Testing/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        NSArray<LYTestListModel *> *listModel = [LYTestListModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"testing_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

/**
 *  在线测试题目数据
 *
 */
+ (void)onlineTestWithQuestId:(NSString *)Id
                      success:(void (^)(NSArray<LYTestQuestListModel *>*))success
                      failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"id":LYNoNullString(Id),
                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Testing/data") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        NSArray<LYTestQuestListModel *> *listModel = [LYTestQuestListModel mj_objectArrayWithKeyValuesArray:requestInfo.data];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
}

/**
 *  统计题目
 */
+ (void)countTestWithcountTestModel:(LYCountTestModel *)model
                            success:(void (^)())success
                            failure:(requestFailureHandle)failure{

    NSDictionary *parameterDic = @{
                                   @"token" : LYNoNullString(model.token),
                                   @"id" : LYNoNullString(model.ID),
                                   @"answer" : model.answers,
                                   @"right_num" : @(model.right_num),
                                   @"error_num" : @(model.error_num),
                                   @"score" : @(model.score),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Testing/submit") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];

    
}


#pragma mark - 轮播图

+ (void)getSlideImageWithToken:(NSString *)token
                    slide_type:(LYSlideType )slide_type
                       success:(void (^)(NSArray<LYBannerModelModel *>*))success
                       failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"slide_type":LYNoNullString([@(slide_type) stringValue]),

                                   };
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Slide/lists") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        NSArray<LYBannerModelModel *> *listModel = [LYBannerModelModel mj_objectArrayWithKeyValuesArray:requestInfo.data[@"slide_list"]];
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success(listModel);
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];
    
}

#pragma mark - 意见反馈
+ (void)sendSuggestionWithToken:(NSString *)token
                        content:(NSString *)content
                        contact:(NSString *)contact
                        success:(void (^)())success
                        failure:(requestFailureHandle)failure{
    
    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"content":LYNoNullString(content),
                                   @"contact" : LYNoNullString(contact)
                                   
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"Feedback/add") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];


}



#pragma mark - 申请提现
+ (void)applyChangeCashWithToken:(NSString *)token
                           money:(NSString *)money
                         success:(void (^)())success
                         failure:(requestFailureHandle)failure{


    NSDictionary *parameterDic = @{
                                   @"token":LYNoNullString(token),
                                   @"money" : LYNoNullString(money),
                                   };
    
    [SLYRequestManager postWithRelativeUrl:LYURLString(@"User/account_cash") Parameters:parameterDic success:^(LYRequestInfo *requestInfo) {
        
        if(success && [requestInfo.error_code isEqualToString:@"0"] ){
            success();
        }else{
            if(failure){
                failure(requestInfo.error_code, requestInfo.error_msg);
            }
        }
    } failure:nil];


}
@end
